package com.zb.vo;

import cn.hutool.core.collection.CollectionUtil;
import com.zb.annotation.NumberPattern;
import com.zb.entity.CodeScanInfoVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author WEN
 * @Date 2023/11/11 0011
 **/
@Data
@ApiModel("编码扫码详情设置对象")
public class CodeScanDetailSetVo {
    @NotNull(message = "选项类型不能为空")
    @NumberPattern(regexp = "^(1|2|3|4|5|6|7|8|9)$", message = "选项类型参数不合法", required = true)
    @ApiModelProperty(value = "选项类型：1-基础选项，2-图片图片，3-商品信息，4-防伪编码，5-商品编码信息，6-商品编码登记信息，7-编码登记字段参数，8-商品简介与参数说明，9-自定义字段", required = true, example = "0")
    private Integer type;

    @NumberPattern(regexp = "^(0|1|2|3)$", message = "自定义字段类型参数不合法")
    @ApiModelProperty(value = "自定义字段类型：0-无，1-多行文本，2-图片，3-视频，当 category=9 时，该字段生效", example = "0")
    private Integer fieldType;

    @Valid
    @ApiModelProperty(value = "数据内容集合对象")
    private List<CodeScanDetailContentSetVo> data;

    public CodeScanDetailSetVo() {
    }

    public CodeScanDetailSetVo(Integer type, List<CodeScanDetailContentSetVo> data) {
        this.type = type;
        this.fieldType = 0;
        this.data = data;
    }

    public CodeScanDetailSetVo(Integer type, Integer fieldType, List<CodeScanDetailContentSetVo> data) {
        this.type = type;
        this.fieldType = fieldType;
        this.data = data;
    }



    public static List<CodeScanDetailSetVo> getDefaultVal() {
        List<CodeScanDetailSetVo> voList = new ArrayList<>();
        List<CodeScanDetailContentSetVo> contentSetVos = new ArrayList<>();
        contentSetVos.add(new CodeScanDetailContentSetVo(1, "页面颜色", "#007cff", true));
        contentSetVos.add(new CodeScanDetailContentSetVo(2, "右侧标题", "编码详情", true));
        contentSetVos.add(new CodeScanDetailContentSetVo(3, "左侧图标", "https://img.tukuppt.com/ad_preview/00/18/27/iz5OL6O1wG.jpg!/fw/260", true));
        contentSetVos.add(new CodeScanDetailContentSetVo(4, "登记按钮", "登记激活", true));
        contentSetVos.add(new CodeScanDetailContentSetVo(5, "报修按钮", "报单申请", true));
        voList.add(new CodeScanDetailSetVo(1, contentSetVos));

        contentSetVos = new ArrayList<>();
        contentSetVos.add(new CodeScanDetailContentSetVo("产品图片", new ArrayList<>(), true));
        voList.add(new CodeScanDetailSetVo(2, contentSetVos));

        // 1-商品品牌，2-商品分类，3-商品名称，4-商品型号
        contentSetVos = new ArrayList<>();
        contentSetVos.add(new CodeScanDetailContentSetVo(1, "产品信息", new int[]{1,2,3,4}, true));
        contentSetVos.add(new CodeScanDetailContentSetVo(2, "商品规格", "SP-xx50-2", true));
        contentSetVos.add(new CodeScanDetailContentSetVo(3, "商品货号", "HH-158xx", true));
        contentSetVos.add(new CodeScanDetailContentSetVo(4, "商品价格", "￥100", true));
        voList.add(new CodeScanDetailSetVo(3, contentSetVos));

        contentSetVos = new ArrayList<>();
        contentSetVos.add(new CodeScanDetailContentSetVo( "防伪编码", "MO5jD66PWBD5E0tAGC", true));
        voList.add(new CodeScanDetailSetVo(4, contentSetVos));

        // 1- 编码是否激活，2-编码激活时间，3-编码状态，4-编码质保开始时间，5-编码质保到期时间，6-编码登记时间，7-编码查询次数，8-首次查询时间，9-最后查询时间，10-产品入库时间，11-产品出库时间，12-销售经销商
        contentSetVos = new ArrayList<>();
        contentSetVos.add(new CodeScanDetailContentSetVo( 1, "编码是否激活", "已激活/未激活", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 2, "编码激活时间", "2023-11-11 10:34:07", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 3, "编码状态", "质保中", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 4, "编码质保开始时间", "2023-11-11 10:34:07", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 5, "编码质保到期时间", "2024-12-11 10:34:07", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 6, "编码登记时间", "2023-11-11 10:34:07", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 7, "编码查询次数", 0, true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 8, "首次查询时间", "2023-11-11 10:34:07", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 9, "最后查询时间", "2024-12-11 10:34:07", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 10, "产品入库时间", "2023-11-11 10:34:07", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 11, "产品出库时间", "2023-11-11 10:34:07", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 12, "销售经销商", "海田服务商", true));
        voList.add(new CodeScanDetailSetVo(5, contentSetVos));

        // 1- 客户登记姓名，2-客户登记手机号，3-客户登记地址
        contentSetVos = new ArrayList<>();
        contentSetVos.add(new CodeScanDetailContentSetVo( 1, "客户登记姓名", "田xxx", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 2, "客户登记手机号", "150xxxxxxxx", true));
        contentSetVos.add(new CodeScanDetailContentSetVo( 3, "客户登记地址", "广东省深圳市宝安区xxxx路", true));
        voList.add(new CodeScanDetailSetVo(6, contentSetVos));

        contentSetVos = new ArrayList<>();
        contentSetVos.add(new CodeScanDetailContentSetVo("编码登记字段参数", "编码登记字段参数", true));
        voList.add(new CodeScanDetailSetVo(7, contentSetVos));

        // 1-产品简介，2-产品参数，3-产品说明书，4-产品视频,5-故障库
        contentSetVos = new ArrayList<>();
        contentSetVos.add(new CodeScanDetailContentSetVo(1, "产品简介", "产品简介", true));
        contentSetVos.add(new CodeScanDetailContentSetVo(2, "产品参数", "产品参数", true));
        contentSetVos.add(new CodeScanDetailContentSetVo(3, "产品说明书", "产品说明书", true));
        contentSetVos.add(new CodeScanDetailContentSetVo(4, "产品视频", "产品视频", true));
        contentSetVos.add(new CodeScanDetailContentSetVo(5, "故障库", "故障库", true));
        voList.add(new CodeScanDetailSetVo(8, contentSetVos));

        contentSetVos = new ArrayList<>();
        contentSetVos.add(new CodeScanDetailContentSetVo(0,1, "多行文本", "多行文本", true));
        // 字段类型：1-多行文本，2-图片，3-视频
        voList.add(new CodeScanDetailSetVo(9, 1, contentSetVos));

        contentSetVos = new ArrayList<>();
        contentSetVos.add(new CodeScanDetailContentSetVo(0,1, "图片", "图片", true));
        // 字段类型：1-多行文本，2-图片，3-视频
        voList.add(new CodeScanDetailSetVo(9, 2, contentSetVos));

        contentSetVos = new ArrayList<>();
        contentSetVos.add(new CodeScanDetailContentSetVo(0,1, "视频", "视频", true));
        // 字段类型：1-多行文本，2-图片，3-视频
        voList.add(new CodeScanDetailSetVo(9, 3, contentSetVos));
        return voList;
    }

}
